TARGET = $(LIB)libconfig.a
DEBUG_TARGET = $(LIB)libdebug_config.a
UT_TARGET = $(LIB)libut_config.a

#All
.PHONY: all
all: $(TARGET)
$(TARGET): $(TARGET)(ProfileXml.o Profile.o ConfigXml.o Config.o)
ProfileXml.o: ProfileXml.cpp ProfileXml.h
	$(CXXFLAGS) -c -I$(ERROR_SRC) -I$(UTILITY_SRC) -I $(INCLUDE) ProfileXml.cpp 
Profile.o: Profile.cpp Profile.h
	$(CXXFLAGS) -c Profile.cpp 
ConfigXml.o: ConfigXml.cpp ConfigXml.h
	$(CXXFLAGS) -c -I$(ERROR_SRC) -I$(INCLUDE) ConfigXml.cpp 
Config.o: Config.cpp Config.h
	$(CXXFLAGS) -c Config.cpp 

#Debug
.PHONY: debug
debug: $(DEBUG_TARGET)
$(DEBUG_TARGET): $(DEBUG_TARGET)(debug_ProfileXml.o debug_Profile.o debug_ConfigXml.o debug_Config.o)
debug_ProfileXml.o: ProfileXml.cpp ProfileXml.h
	$(CXXFLAGS) -c $(DEBUG_FLAGS) -o debug_ProfileXml.o \
			-I$(ERROR_SRC) -I$(UTILITY_SRC) -I $(INCLUDE) ProfileXml.cpp 
debug_Profile.o: Profile.cpp Profile.h
	$(CXXFLAGS) -c $(DEBUG_FLAGS) -o debug_Profile.o Profile.cpp 
debug_ConfigXml.o: ConfigXml.cpp ConfigXml.h
	$(CXXFLAGS) -c $(DEBUG_FLAGS) -o debug_ConfigXml.o \
			-I$(ERROR_SRC) -I$(INCLUDE) ConfigXml.cpp 
debug_Config.o: Config.cpp Config.h
	$(CXXFLAGS) -c $(DEBUG_FLAGS) -o debug_Config.o Config.cpp 

#Unit Test
.PHONY: ut
ut: $(UT_TARGET)
$(UT_TARGET): $(UT_TARGET)(ut_ProfileXml.o ProfileXmlTest.o ut_Profile.o ProfileTest.o ut_ConfigXml.o ConfigXmlTest.o ut_Config.o ConfigTest.o)
ut_ProfileXml.o: ProfileXml.cpp ProfileXml.h
	$(CXXFLAGS) -c $(UT_FLAGS) -o ut_ProfileXml.o -I $(INCLUDE) ProfileXml.cpp
ProfileXmlTest.o: ProfileXml.cpp ProfileXml.h ProfileXmlTest.cpp ProfileXmlTest.h
	$(CXXFLAGS) -c $(UT_FLAGS) -I $(INCLUDE) ProfileXmlTest.cpp
ut_Profile.o: Profile.cpp Profile.h
	$(CXXFLAGS) -c $(UT_FLAGS) -o ut_Profile.o Profile.cpp
ProfileTest.o: Profile.cpp Profile.h ProfileTest.cpp ProfileTest.h
	$(CXXFLAGS) -c $(UT_FLAGS) ProfileTest.cpp 
ut_ConfigXml.o: ConfigXml.cpp ConfigXml.h
	$(CXXFLAGS) -c $(UT_FLAGS) -o ut_ConfigXml.o -I $(INCLUDE) ConfigXml.cpp
ConfigXmlTest.o: ConfigXml.cpp ConfigXml.h ConfigXmlTest.cpp ConfigXmlTest.h
	$(CXXFLAGS) -c $(UT_FLAGS) -I $(INCLUDE) ConfigXmlTest.cpp
ut_Config.o: Config.cpp Config.h
	$(CXXFLAGS) -c $(UT_FLAGS) -o ut_Config.o Config.cpp
ConfigTest.o: Config.cpp Config.h ConfigTest.cpp ConfigTest.h
	$(CXXFLAGS) -c $(UT_FLAGS) ConfigTest.cpp 

#Clean
.PHONY: clean
clean:
	-rm *.o $(TARGET) $(DEBUG_TARGET) $(UT_TARGET)
